/*
 * @Author: 星孑
 * @Date: 2022-04-12 16:26:32
 * @LastEditors: 星孑
 * @LastEditTime: 2022-04-12 16:26:32
 * @FilePath: /vue-template-web/src/api/user.js
 * @Description: 用户权限api
 */
import request from '@/utils/request'

export function getUserList(params) {
  return request({
    url: `/member/admin/user/page`,
    method: 'get',
    params
  })
}

export function addUser(data) {
  return request({
    url: `/member/admin/add`,
    method: 'post',
    data
  })
}

export function editUser(data) {
  return request({
    url: `/member/admin/update`,
    method: 'put',
    data
  })
}

export function delUser(params) {
  return request({
    url: `/member/admin/delete`,
    method: 'delete',
    params
  })
}

export function getRoleList(params) {
  return request({
    url: `/member/role/page`,
    method: 'get',
    params
  })
}

export function addRole(data) {
  return request({
    url: `/member/role/add`,
    method: 'post',
    data
  })
}

export function delRole(params) {
  return request({
    url: `/member/role/delete`,
    method: 'delete',
    params
  })
}

export function getRoleMenus(params) {
  return request({
    url: `/member/permission/role/list`,
    method: 'get',
    params
  })
}

export function editRole(data) {
  return request({
    url: `/member/role/update`,
    method: 'put',
    data
  })
}

export function getUserListByRole(params) {
  return request({
    url: `/member/role/user/list`,
    method: 'get',
    params
  })
}

export function getUnbindUserList() {
  return request({
    url: `/member/role/user/no/bands`,
    method: 'get'
  })
}

export function roleUnbindUser(data) {
  return request({
    url: `/member/role/user/unbands`,
    method: 'put',
    data
  })
}

export function roleBindUser(data) {
  return request({
    url: `/member/role/user/bands`,
    method: 'put',
    data
  })
}

export function getMenus(params) {
  return request({
    url: `/member/permission/list`,
    method: 'get',
    params
  })
}

export function addMenu(data) {
  return request({
    url: `/member/permission/add`,
    method: 'post',
    data
  })
}

export function editMenu(data) {
  return request({
    url: `/member/permission/update`,
    method: 'put',
    data
  })
}

export function delMenu(params) {
  return request({
    url: `/member/permission/delete`,
    method: 'delete',
    params
  })
}

export function getMenuById(params) {
  return request({
    url: `/member/permission/child/list`,
    method: 'get',
    params
  })
}

// 日志列表
export function getLogPage(params) {
  return request({
    url: `/member/admin/log/page`,
    method: 'get',
    params
  })
}
